package string_test;

import java.util.Arrays;

/**
 * @author yuisama
 * @date 2022/05/07 20:02
 **/
public class StringSplit {
    public static void main(String[] args) {
        String str = "Hello Java Hello Rocket";
        String[] data1 = str.split("-");
        System.out.println(Arrays.toString(data1));
        System.out.println(data1.length);
//        // 按照空格将str拆分，拆分后的字符串数组长度为2
//        String[] data2 = str.split(" ",2);
//        System.out.println(Arrays.toString(data1));
//        System.out.println(Arrays.toString(data2));
        // 拆分IP地址
//        String str = "192.168.1.1";
//        String[] data = str.split("\\.");
//        System.out.println(Arrays.toString(data));
    }
}